﻿using WqLunTan.Models;
using WqLunTan.Models.DataBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WqLunTan.Reply
{
    /// <summary>
    /// 微信消息回复接口
    /// </summary>
    internal interface IReply
    {
        /// <summary>
        /// 回复一条消息
        /// </summary>
        /// <param name="data">命令的参数值</param>
        /// <returns></returns>
        string reply(wechat_data data);
    }

    /// <summary>
    /// 微信消息命令
    /// </summary>
    public enum KeyWord
    {
        /// <summary>
        /// 查看自己微信号的id
        /// </summary>
        id = 0,

        /// <summary>
        /// 查看论坛首页
        /// </summary>
        首页 = 1,

        /// <summary>
        /// 订阅事件, subscribe, 取消订阅事件
        /// </summary>
        subscribe = 2,

        /// <summary>
        /// 取消订阅
        /// </summary>
        unsubscribe = 3,

        /// <summary>
        /// 扫码事件, 已关注的账号扫码
        /// </summary>
        scan = 4,

        /// <summary>
        /// 打开网站登录即可绑定
        /// </summary>
        论坛绑定微信号 = 5,

        /// <summary>
        /// 输入详情可以查看说明
        /// </summary>
        详情 = 6
    }

    /// <summary>
    /// 获取消息回复接口的所有实现类
    /// </summary>
    public class ReplyImplDict
    {
        /// <summary>
        /// 获取 IReply 的实现类
        /// </summary>
        /// <returns></returns>
        public static Dictionary<string, string> getIReplyProvider()
        {
            var dict = new Dictionary<string, string>();
            dict.Add(KeyWord.id.ToString(), nameof(WxUidReply));
            dict.Add(KeyWord.首页.ToString(), nameof(HomePageReply));
            dict.Add(KeyWord.subscribe.ToString(), nameof(SubscribeReply));
            dict.Add(KeyWord.unsubscribe.ToString(), nameof(UnSubscibeReply));
            dict.Add(KeyWord.scan.ToString(), nameof(ScanReply));

            return dict;
        }
    }
}
